package sca.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.sca.service.TestService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @Reference
    private TestService testService;
    @GetMapping("/test")
    @SentinelResource(value = "test",blockHandler = "testHandler",fallback = "fallbackTest")
    public String  test(String msg){
        return  testService.seayHello(msg);
    }
    public String  testHandler(String msg, BlockException exception){
        return "error";
    }
    public String  fallbackTest(String msg){
        return "error";
    }
}
